package blazingbubble.network.lobby.strategy;

import java.util.Collection;

import blazingbubble.graphics.lobby.IGameListUpdateListener;

import moltencore.network.protocol.GameListSendingEnd;
import spark.network.protocol.Acknowledgement;
import spark.network.protocol.Response;
import spark.network.strategy.IProtocolHandleStrategy;
import spark.network.protocol.Base;
import spark.utility.OutWrapper;

public class GameListSendingEndStrategy implements IProtocolHandleStrategy<GameListSendingEnd> {
	private IGameListUpdateListener updateListener;

	@Override
	public void handle(GameListSendingEnd packet, OutWrapper<Response> acknowledgement, Collection<Base> additionalData) {
		updateListener.finishUpdating();
		/*
		 * TODO: do something with the number of sent GameListGameData packets
		 * (this number is contained in the GameListSendingEnd packet)
		 */
		acknowledgement.value = new Acknowledgement(packet);
	}

	public void setGameListUpdateListener(IGameListUpdateListener updateListener){
		this.updateListener = updateListener;
	}
}
